﻿using DbUpgradeDameng.General;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DbUpgradeDameng
{
    public partial class FormHandExecSql : Form
    {
        private int _version = 0;
        private string key = "MKN7HS3E";

        public FormHandExecSql()
        {
            InitializeComponent();
        }

        public void Ini(int version)
        {
            _version = version;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否已经执行语句完毕！！！？？？", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }

        private void btnCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(edtSql.Text);
        }

        private void FormHandExecSql_Load(object sender, EventArgs e)
        {
            string sql = "select sql from UpGradeSql where Version = " + _version;
            string sqltext = App.Dal.ExecScalar(sql).ToStringEx();
            sqltext = DES.Decode(sqltext, key);
            edtSql.Text = sqltext;
            Clipboard.SetDataObject(sqltext);
        }
    }
}
